/****************************************************************************

 XDV Game Engine
 Copyright 2013 - Xavier Durand-Hollis, David Ward, Vitor Makoto Matayoshi
 
 XDVGameObject.h - Created May 30, 2013 by Xavier

 ****************************************************************************/

#ifndef XDVGAMEOBJECT_H_
#define XDVGAMEOBJECT_H_

class XDVComponent;

#include "../Component/XDVComponent.h"
#include <string>
#include <vector>
#include <typeinfo>

class XDVGameObject
{
public:
	XDVGameObject();
	XDVGameObject(std::string name);

	virtual ~XDVGameObject();

	virtual void Awake();
	virtual void Start();
	virtual void FixedUpdate(float deltaTime);
	virtual void Update(float deltaTime);
	virtual void LateUpdate(float deltaTime);

	std::string GetTag(){ return m_tag; }
	void SetTag(std::string tag){ m_tag = tag; }

	std::string GetName(){ return m_name; }
	void SetName(std::string name){ m_name = name; }

	// Get the first component that matches the given string type.
	XDVComponent* GetComponent(std::string type);
	// Get all components that match the given string type.
	std::vector<XDVComponent*> GetComponents(std::string type);

	XDVComponent* AddComponent(XDVComponent& component);

	void SetActiveSelf(bool b); // Also sets all components active field.
	// void SetActiveRecursively(bool b); // TODO: Children stuffs?
	bool IsActiveSelf(){ return m_activeSelf; }

private:
	std::string m_name;
	std::string m_tag;
	std::vector<XDVComponent*> m_components;
	bool m_activeSelf;
};

#endif /* XDVGAMEOBJECT_H_ */
